package com.lsj.juc.myself;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RunnableFuture;

/**
 * @author lsj
 * @create 2021-06-18 9:53
 */
class MyThread implements Callable<String>{

    @Override
    public String call() throws Exception {
        System.out.println("come");
        return "hello!";
    }
}


public class AnyLessonTest {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        RunnableFuture<String> runnableFuture = new FutureTask<>(new MyThread());
        new Thread(runnableFuture, "A").start();

        System.out.println(runnableFuture.get());
    }



}
